package com.laowang.project.system.controller;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.laowang.framework.aspectj.lang.annotation.Log;
import com.laowang.framework.aspectj.lang.enums.BusinessType;

import org.springframework.web.bind.annotation.*;
import com.laowang.project.system.domain.MyCyhMarkPrice;
import com.laowang.project.system.service.MyCyhMarkPriceService;
import com.laowang.framework.web.controller.BaseController;
import com.laowang.framework.web.domain.AjaxResult;
import com.laowang.common.utils.poi.ExcelUtil;
import com.laowang.framework.web.page.TableDataInfo;

/**
 * 副牌价格Controller
 *
 * @author laowang
 * @date 2023-06-14
 */
@Api(tags = "副牌价格接口")
@RestController
@RequestMapping("/markPrice")
public class MyCyhMarkPriceController extends BaseController {
    @Autowired
    private MyCyhMarkPriceService myCyhMarkPriceService;

    /**
     * 查询副牌价格列表
     */
    @ApiOperation(value = "查询副牌价格列表",notes = "")
    @PreAuthorize("@ss.hasPermi('my:markPrice:list')")
    @GetMapping("/list")
    public TableDataInfo list(MyCyhMarkPrice myCyhMarkPrice) {
        startPage();
        List<MyCyhMarkPrice> list = myCyhMarkPriceService.selectMyCyhMarkPriceList(myCyhMarkPrice);
        return getDataTable(list);
    }

    /**
     * 导出副牌价格列表
     */
    @ApiOperation(value = "导出副牌价格列表",notes = "")
    @PreAuthorize("@ss.hasPermi('my:markPrice:export')")
    @GetMapping("/export")
    public AjaxResult export(MyCyhMarkPrice myCyhMarkPrice) {
        List<MyCyhMarkPrice> list = myCyhMarkPriceService.selectMyCyhMarkPriceList(myCyhMarkPrice);
        ExcelUtil<MyCyhMarkPrice> util = new ExcelUtil<MyCyhMarkPrice>(MyCyhMarkPrice.class);
        return util.exportExcel(list, "markPrice");
    }

    /**
     * 获取副牌价格详细信息
     */
    @ApiOperation(value = "获取副牌价格详细信息",notes = "")
    @PreAuthorize("@ss.hasPermi('my:markPrice:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id) {
        return AjaxResult.success(myCyhMarkPriceService.selectMyCyhMarkPriceById(id));
    }

    /**
     * 新增副牌价格
     */
    @ApiOperation(value = "新增副牌价格",notes = "")
    @PreAuthorize("@ss.hasPermi('my:markPrice:add')")
    @PostMapping
    public AjaxResult add(@RequestBody MyCyhMarkPrice myCyhMarkPrice) {
        return toAjax(myCyhMarkPriceService.insertMyCyhMarkPrice(myCyhMarkPrice));
    }

    /**
     * 修改副牌价格
     */
    @ApiOperation(value = "修改副牌价格",notes = "")
    @PreAuthorize("@ss.hasPermi('my:markPrice:edit')")
    @PutMapping
    public AjaxResult edit(@RequestBody MyCyhMarkPrice myCyhMarkPrice) {
        return toAjax(myCyhMarkPriceService.updateMyCyhMarkPrice(myCyhMarkPrice));
    }

    /**
     * 删除副牌价格
     */
    @ApiOperation(value = "删除副牌价格",notes = "")
    @PreAuthorize("@ss.hasPermi('my:markPrice:remove')")
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids) {
        return toAjax(myCyhMarkPriceService.deleteMyCyhMarkPriceByIds(ids));
    }
}
